<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function cunZai(num, arr) {
            let flag = false;
            for (i = 0; i < arr.length; i++) {
                if (num == arr[i]) {
                    flag = !flag;
                    break;
                } else {
                    flag = flag;
                }
            }
            return flag;
        }
        let num = +prompt("请输入一个数");
        let arr = [1, 2, 8, 9, 6];
        document.write(cunZai(num, arr));
    </script>
</body>

</html>